package competition;

import java.util.Scanner;

/**
 * @author ZhanBo
 * @date 2020/7/25
 */
public class MainD {

    public static int uniquePathsWithObstacles(int[][] obstacleGrid,int x ,int y) {
        int n = obstacleGrid.length, m = obstacleGrid[0].length;
        int[] f = new int[m];
        f[0] = obstacleGrid[0][0] == 0 ? 1 : 0;
        for (int i = x; i < n; ++i) {
            for (int j = y; j < m; ++j) {
                if (obstacleGrid[i][j] == 1) {
                    f[j] = 0;
                    continue;
                }
                if (j - 1 >= 0 && obstacleGrid[i][j - 1] == 0) {
                    f[j] += f[j - 1];
                }
            }
        }
        return f[m - 1]%1000000007;
    }

    public static void main(String[] args) {
        Scanner scanner =new Scanner(System.in);
        while (scanner.hasNext()){
            int aX = scanner.nextInt();
            int aY = scanner.nextInt();
            int bX = scanner.nextInt();
            int bY = scanner.nextInt();
            int cX = scanner.nextInt();
            int cY = scanner.nextInt();
            int [] [] obstacleGrid = new int[cX][cY];
            obstacleGrid[bX-1][bY-1] = 1;
            System.out.println(uniquePathsWithObstacles(obstacleGrid,aX-1,aY-1));
        }
    }
}

